package cn.javass.dp.iterator.example1;

public class Client {

    public void someOperation() {
        String[] names = {"张三","李四","王五"};
        Aggregate aggregate = new ConcreteAggregate(names);
        Iterator it = aggregate.createIterator();

        it.first();
        while (!it.isDone()) {
            Object obj = it.currentItem();
            System.out.println("obj = " + obj);
            it.next();
        }

    }

    public static void main(String[] args) {
        Client client = new Client();
        client.someOperation();
    }
}
